package com.up.cloudfeiyibackend.service.impl;

import com.up.cloudfeiyibackend.constant.ItemMapConstant;
import com.up.cloudfeiyibackend.entity.IchDisputes;
import com.up.cloudfeiyibackend.mapper.ItemMapMapper;
import com.up.cloudfeiyibackend.result.Result;
import com.up.cloudfeiyibackend.service.ItemMapService;
import com.up.cloudfeiyibackend.vo.IchDisputesVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class ItemMapServiceImpl implements ItemMapService {
    @Autowired
    private ItemMapMapper itemMapMapper;

    /**
     * 获取所有非遗坐标信息
     *
     * @return
     */
    @Override
    public Result<List<IchDisputesVO>> getItemMap() {
        List<IchDisputes> ichDisputesList = itemMapMapper.getAllDisputes();
        List<IchDisputesVO> ichDisputesVOList = new ArrayList<>();
        for (IchDisputes disputes : ichDisputesList) {
            IchDisputesVO ichDisputesVO = new IchDisputesVO();
            BeanUtils.copyProperties(disputes, ichDisputesVO);
            ichDisputesVOList.add(ichDisputesVO);
        }
        return Result.success(ItemMapConstant.GET_ITEM_MAP_SUCCESS,ichDisputesVOList) ;
    }
}
